home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / RAVESystem.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  15.5 KB  |  373 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        RAVESystem.h
  3.  
  4.      Contains:    Interfaces needed when building RAVE engines                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __RAVESYSTEM__
  18. #define __RAVESYSTEM__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #ifndef __RAVE__
  25.     #include <RAVE.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=power
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. #if PRAGMA_ENUM_ALWAYSINT
  53.     #pragma enumsalwaysint on
  54. #elif PRAGMA_ENUM_OPTIONS
  55.     #pragma option enum=int
  56. #elif PRAGMA_ENUM_PACK
  57.     #if __option(pack_enums)
  58.         #define PRAGMA_ENUM_PACK__RAVESYSTEM__
  59.     #endif
  60.     #pragma options(!pack_enums)
  61. #endif
  62.  
  63.  
  64. /************************************************************************************************
  65.  *
  66.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  67.  *
  68.  ***********************************************************************************************/
  69. /* TQAColorTableNew    parameter descriptions */
  70. /* TQAColorTableType    pixelType            Depth, color space, etc. */
  71. /* void                    *pixelData            lookup table entries in pixelType format */
  72. /* long                    transparentIndex    boolean, false means no transparency, true means index 0 is transparent */
  73. /* TQAColorTable        **newTable            (Out) Newly created TQAColorTable */
  74. typedef CALLBACK_API_C( TQAError , TQAColorTableNew )(TQAColorTableType pixelType, void *pixelData, long transparentIndex, TQAColorTable **newTable);
  75. /* TQAColorTableDelete    parameter descriptions */
  76. /* TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  77. typedef CALLBACK_API_C( void , TQAColorTableDelete )(TQAColorTable *colorTable);
  78. /* TQATextureNew    parameter descriptions */
  79. /*    unsigned long        flags                Mask of kQATexture_xxx flags */
  80. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  81. /*    const TQAImage        images[]            Image(s) for texture */
  82. /*    TQATexture            **newTexture        (Out) Newly created TQATexture, or NULL on error */
  83. typedef CALLBACK_API_C( TQAError , TQATextureNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage images[], TQATexture **newTexture);
  84. /* TQATextureDetach    parameter descriptions */
  85. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  86. typedef CALLBACK_API_C( TQAError , TQATextureDetach )(TQATexture *texture);
  87. /* TQATextureDelete    parameter descriptions */
  88. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  89. typedef CALLBACK_API_C( void , TQATextureDelete )(TQATexture *texture);
  90. /* TQATextureBindColorTable    parameter descriptions */
  91. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  92. /*    TQAColorTable        *colorTable            Previously allocated by QAColorTableNew() */
  93. typedef CALLBACK_API_C( TQAError , TQATextureBindColorTable )(TQATexture *texture, TQAColorTable *colorTable);
  94. /* TQABitmapNew    parameter descriptions */
  95. /*    unsigned long        flags                Mask of kQABitmap_xxx flags */
  96. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  97. /*    const TQAImage        *image                Image */
  98. /*    TQABitmap            **newBitmap            (Out) Newly created TQABitmap, or NULL on error */
  99. typedef CALLBACK_API_C( TQAError , TQABitmapNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage *image, TQABitmap **newBitmap);
  100. /* TQABitmapDetach    parameter descriptions */
  101. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  102. typedef CALLBACK_API_C( TQAError , TQABitmapDetach )(TQABitmap *bitmap);
  103. /* TQABitmapDelete    parameter descriptions */
  104. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  105. typedef CALLBACK_API_C( void , TQABitmapDelete )(TQABitmap *bitmap);
  106. /* TQABitmapBindColorTable    parameter descriptions */
  107. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  108. /*    TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  109. typedef CALLBACK_API_C( TQAError , TQABitmapBindColorTable )(TQABitmap *bitmap, TQAColorTable *colorTable);
  110. /************************************************************************************************
  111.  *
  112.  * Typedefs of private (system-only) functions provided by the drawing engine.
  113.  *
  114.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  115.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  116.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  117.  *
  118.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  119.  *
  120.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  121.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  122.  *
  123.  * TQADrawMethodGet and TQAStoreMethodGet are called by the RAVE manager to retrieve
  124.  * the method pointers for a drawing engine.
  125.  *
  126.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  127.  * indicated GDevice.
  128.  *
  129.  ***********************************************************************************************/
  130. /* TQADrawPrivateNew    parameter descriptions */
  131. /*    TQADrawContext        *newDrawContext        Draw context to initialize */
  132. /*    const TQADevice        *device                Target device */
  133. /*    const TQARect        *rect                Target rectangle (device coordinates) */
  134. /*    const TQAClip        *clip                2D clip region (or NULL) */
  135. /*    unsigned long        flags                Mask of kQAContext_xxx */
  136. typedef CALLBACK_API_C( TQAError , TQADrawPrivateNew )(TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
  137. /* TQADrawPrivateDelete    parameter descriptions */
  138. /*    TQADrawPrivate        *drawPrivate        Private context data to delete */
  139. typedef CALLBACK_API_C( void , TQADrawPrivateDelete )(TQADrawPrivate *drawPrivate);
  140. /* TQAEngineCheckDevice    parameter descriptions */
  141. /*    const TQADevice        *device            Target device */
  142. typedef CALLBACK_API_C( TQAError , TQAEngineCheckDevice )(const TQADevice *device);
  143. /* TQAEngineGestalt    parameter descriptions */
  144. /*    TQAGestaltSelector    selector            Gestalt parameter being requested */
  145. /*    void                *response            Buffer that receives response */
  146. typedef CALLBACK_API_C( TQAError , TQAEngineGestalt )(TQAGestaltSelector selector, void *response);
  147.  
  148. /* new engine methods for RAVE 1.6 */
  149. typedef CALLBACK_API_C( TQAError , TQAAccessTexture )(TQATexture *texture, long mipmapLevel, long flags, TQAPixelBuffer *buffer);
  150. typedef CALLBACK_API_C( TQAError , TQAAccessTextureEnd )(TQATexture *texture, const TQARect *dirtyRect);
  151. typedef CALLBACK_API_C( TQAError , TQAAccessBitmap )(TQABitmap *bitmap, long flags, TQAPixelBuffer *buffer);
  152. typedef CALLBACK_API_C( TQAError , TQAAccessBitmapEnd )(TQABitmap *bitmap, const TQARect *dirtyRect);
  153. /************************************************************************************************
  154.  *
  155.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  156.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  157.  * requested.
  158.  *
  159.  ***********************************************************************************************/
  160.  
  161. union TQAEngineMethod {
  162.     TQADrawPrivateNew                 drawPrivateNew;                /* Method: Create a private draw context */
  163.     TQADrawPrivateDelete             drawPrivateDelete;            /* Method: Delete a private draw context */
  164.     TQAEngineCheckDevice             engineCheckDevice;            /* Method: Check a device for drawing */
  165.     TQAEngineGestalt                 engineGestalt;                /* Method: Gestalt */
  166.     TQATextureNew                     textureNew;                    /* Method: Create a texture (load is non-blocking) */
  167.     TQATextureDetach                 textureDetach;                /* Method: Complete load of a texture (blocking) */
  168.     TQATextureDelete                 textureDelete;                /* Method: Delete a texture */
  169.     TQABitmapNew                     bitmapNew;                    /* Method: Create a bitmap (load is non-blocking)  */
  170.     TQABitmapDetach                 bitmapDetach;                /* Method: Complete load of a bitmap (blocking) */
  171.     TQABitmapDelete                 bitmapDelete;                /* Method: Delete a bitmap */
  172.     TQAColorTableNew                 colorTableNew;                /* Method: Create a new color table */
  173.     TQAColorTableDelete             colorTableDelete;            /* Method: Create a new color table */
  174.     TQATextureBindColorTable         textureBindColorTable;        /* Method: Bind a CLUT to a texture */
  175.     TQABitmapBindColorTable         bitmapBindColorTable;        /* Method: Bind a CLUT to a bitmap */
  176.     TQAAccessTexture                 accessTexture;
  177.     TQAAccessTextureEnd             accessTextureEnd;
  178.     TQAAccessBitmap                 accessBitmap;
  179.     TQAAccessBitmapEnd                 accessBitmapEnd;
  180. };
  181. typedef union TQAEngineMethod            TQAEngineMethod;
  182.  
  183. enum TQAEngineMethodTag {
  184.     kQADrawPrivateNew            = 0,
  185.     kQADrawPrivateDelete        = 1,
  186.     kQAEngineCheckDevice        = 2,
  187.     kQAEngineGestalt            = 3,
  188.     kQATextureNew                = 4,
  189.     kQATextureDetach            = 5,
  190.     kQATextureDelete            = 6,
  191.     kQABitmapNew                = 7,
  192.     kQABitmapDetach                = 8,
  193.     kQABitmapDelete                = 9,
  194.     kQAColorTableNew            = 10,
  195.     kQAColorTableDelete            = 11,
  196.     kQATextureBindColorTable    = 12,
  197.     kQABitmapBindColorTable        = 13,
  198.     kQAAccessTexture            = 14,
  199.     kQAAccessTextureEnd            = 15,
  200.     kQAAccessBitmap                = 16,
  201.     kQAAccessBitmapEnd            = 17
  202. };
  203. typedef enum TQAEngineMethodTag TQAEngineMethodTag;
  204.  
  205. /************************************************************************************************
  206.  *
  207.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  208.  * initialization code to register itself with the system. This call takes only one parameter,
  209.  * the engine's function that allows the manager to request the other methods.
  210.  *
  211.  ***********************************************************************************************/
  212. /* TQAEngineGetMethod    parameter descriptions */
  213. /*    TQAEngineMethodTag        methodTag                Method being requested */
  214. /*    TQAEngineMethod            *method                    (Out) Method */
  215. typedef CALLBACK_API_C( TQAError , TQAEngineGetMethod )(TQAEngineMethodTag methodTag, TQAEngineMethod *method);
  216. /* QARegisterEngine    parameter descriptions */
  217. /*    TQAEngineGetMethod        engineGetMethod        Engine's getMethod method */
  218. EXTERN_API_C( TQAError )
  219. QARegisterEngine                (TQAEngineGetMethod     engineGetMethod);
  220.  
  221.  
  222. /* QARegisterEngineWithRefCon parameter descriptions */
  223. /*    TQAEngineGetMethod        engineGetMethod        Engine's getMethod method */
  224. /*  long                    refCon                Engine RefCon */
  225. EXTERN_API_C( TQAError )
  226. QARegisterEngineWithRefCon        (TQAEngineGetMethod     engineGetMethod,
  227.                                  long                     refCon);
  228.  
  229. /* QAGetEngineRefCon parameter descriptions */
  230. EXTERN_API_C( long )
  231. QAGetCurrentEngineRefCon        (void);
  232.  
  233.  
  234. /************************************************************************************************
  235.  *
  236.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  237.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  238.  * passed.
  239.  *
  240.  ***********************************************************************************************/
  241.  
  242. union TQADrawMethod {
  243.     TQASetFloat                     setFloat;                    /* Method: Set a float state variable */
  244.     TQASetInt                         setInt;                        /* Method: Set an unsigned long state variable */
  245.     TQASetPtr                         setPtr;                        /* Method: Set an unsigned long state variable */
  246.     TQAGetFloat                     getFloat;                    /* Method: Get a float state variable */
  247.     TQAGetInt                         getInt;                        /* Method: Get an unsigned long state variable */
  248.     TQAGetPtr                         getPtr;                        /* Method: Get an pointer state variable */
  249.     TQADrawPoint                     drawPoint;                    /* Method: Draw a point */
  250.     TQADrawLine                     drawLine;                    /* Method: Draw a line */
  251.     TQADrawTriGouraud                 drawTriGouraud;                /* Method: Draw a Gouraud shaded triangle */
  252.     TQADrawTriTexture                 drawTriTexture;                /* Method: Draw a texture mapped triangle */
  253.     TQADrawVGouraud                 drawVGouraud;                /* Method: Draw Gouraud vertices */
  254.     TQADrawVTexture                 drawVTexture;                /* Method: Draw texture vertices */
  255.     TQADrawBitmap                     drawBitmap;                    /* Method: Draw a bitmap */
  256.     TQARenderStart                     renderStart;                /* Method: Initialize for rendering */
  257.     TQARenderEnd                     renderEnd;                    /* Method: Complete rendering and display */
  258.     TQARenderAbort                     renderAbort;                /* Method: Abort any outstanding rendering (blocking) */
  259.     TQAFlush                         flush;                        /* Method: Start render of any queued commands (non-blocking) */
  260.     TQASync                         sync;                        /* Method: Wait for completion of all rendering (blocking) */
  261.     TQASubmitVerticesGouraud         submitVerticesGouraud;        /* Method: Submit Gouraud vertices for trimesh */
  262.     TQASubmitVerticesTexture         submitVerticesTexture;        /* Method: Submit Texture vertices for trimesh */
  263.     TQADrawTriMeshGouraud             drawTriMeshGouraud;            /* Method: Draw a Gouraud triangle mesh */
  264.     TQADrawTriMeshTexture             drawTriMeshTexture;            /* Method: Draw a Texture triangle mesh */
  265.     TQASetNoticeMethod                 setNoticeMethod;            /* Method: Set a notice method */
  266.     TQAGetNoticeMethod                 getNoticeMethod;            /* Method: Get a notice method */
  267.  
  268.                                                                 /* new in 1.6 */
  269.     TQASubmitMultiTextureParams     submitMultiTextureParams;    /* Method: Submit secondary texture params */
  270.     TQAAccessDrawBuffer             accessDrawBuffer;
  271.     TQAAccessDrawBufferEnd             accessDrawBufferEnd;
  272.     TQAAccessZBuffer                 accessZBuffer;
  273.     TQAAccessZBufferEnd             accessZBufferEnd;
  274.     TQAClearDrawBuffer                 clearDrawBuffer;
  275.     TQAClearZBuffer                 clearZBuffer;
  276.     TQATextureNewFromDrawContext     textureFromContext;
  277.     TQABitmapNewFromDrawContext     bitmapFromContext;
  278.     TQABusy                         busy;
  279.     TQASwapBuffers                     swapBuffers;
  280. };
  281. typedef union TQADrawMethod                TQADrawMethod;
  282.  
  283. enum TQADrawMethodTag {
  284.     kQASetFloat                    = 0,
  285.     kQASetInt                    = 1,
  286.     kQASetPtr                    = 2,
  287.     kQAGetFloat                    = 3,
  288.     kQAGetInt                    = 4,
  289.     kQAGetPtr                    = 5,
  290.     kQADrawPoint                = 6,
  291.     kQADrawLine                    = 7,
  292.     kQADrawTriGouraud            = 8,
  293.     kQADrawTriTexture            = 9,
  294.     kQADrawVGouraud                = 10,
  295.     kQADrawVTexture                = 11,
  296.     kQADrawBitmap                = 12,
  297.     kQARenderStart                = 13,
  298.     kQARenderEnd                = 14,
  299.     kQARenderAbort                = 15,
  300.     kQAFlush                    = 16,
  301.     kQASync                        = 17,
  302.     kQASubmitVerticesGouraud    = 18,
  303.     kQASubmitVerticesTexture    = 19,
  304.     kQADrawTriMeshGouraud        = 20,
  305.     kQADrawTriMeshTexture        = 21,
  306.     kQASetNoticeMethod            = 22,
  307.     kQAGetNoticeMethod            = 23,
  308.     kQSubmitMultiTextureParams    = 24,
  309.     kQAccessDrawBuffer            = 25,
  310.     kQAccessDrawBufferEnd        = 26,
  311.     kQAccessZBuffer                = 27,
  312.     kQAccessZBufferEnd            = 28,
  313.     kQClearDrawBuffer            = 29,
  314.     kQClearZBuffer                = 30,
  315.     kQTextureNewFromDrawContext    = 31,
  316.     kQBitmapNewFromDrawContext    = 32,
  317.     kQBusy                        = 33,
  318.     kQSwapBuffers                = 34
  319. };
  320. typedef enum TQADrawMethodTag TQADrawMethodTag;
  321.  
  322. /************************************************************************************************
  323.  *
  324.  * System call to register a new method for an engine. This is called during the engine's
  325.  * draw private new functions (to set the initial value of the draw methods), and possibly
  326.  * at other times when the engine needs to change a draw method.
  327.  *
  328.  ***********************************************************************************************/
  329. /* QARegisterDrawMethod    parameter descriptions */
  330. /*    TQADrawContext            *drawContext            Draw context in which to set method */
  331. /*    TQADrawMethodTag        methodTag                Method to set */
  332. /*    TQADrawMethod            method                    Method */
  333. EXTERN_API_C( TQAError )
  334. QARegisterDrawMethod            (TQADrawContext *        drawContext,
  335.                                  TQADrawMethodTag         methodTag,
  336.                                  TQADrawMethod             method);
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. #if PRAGMA_ENUM_ALWAYSINT
  346.     #pragma enumsalwaysint reset
  347. #elif PRAGMA_ENUM_OPTIONS
  348.     #pragma option enum=reset
  349. #elif defined(PRAGMA_ENUM_PACK__RAVESYSTEM__)
  350.     #pragma options(pack_enums)
  351. #endif
  352.  
  353. #if PRAGMA_STRUCT_ALIGN
  354.     #pragma options align=reset
  355. #elif PRAGMA_STRUCT_PACKPUSH
  356.     #pragma pack(pop)
  357. #elif PRAGMA_STRUCT_PACK
  358.     #pragma pack()
  359. #endif
  360.  
  361. #ifdef PRAGMA_IMPORT_OFF
  362. #pragma import off
  363. #elif PRAGMA_IMPORT
  364. #pragma import reset
  365. #endif
  366.  
  367. #ifdef __cplusplus
  368. }
  369. #endif
  370.  
  371. #endif /* __RAVESYSTEM__ */
  372.  
  373.